<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div{
            width: 200px;
            height: 200px;
            background: palegoldenrod;
        }
    </style>
</head>
<body>
    <button>移除事件监听</button>
    <div></div>
    <script>
        var box = document.querySelector('div')
        var btn = document.querySelector('button')

        //先监听先触发
        box.addEventListener('click',function(){
            console.log(1)
        },true)
        
        box.addEventListener('click',function(){
            console.log(2)
        },true)
        
        function fn(){
            console.log(3)
        }
        box.addEventListener('click',fn,true)

        btn.addEventListener('click',function(){
            box.removeEventListener('click',fn,true)
        })
    </script>
</body>
</html>